<?php
namespace app\index\controller;
use app\index\model\Push as Pushs;
class Push extends Comm
{

    public function index()
    {
        $pushs=new Pushs();
        $res=$pushs->AllData();
        return view('index',['res'=>$res]);
    }
    public function update(){
        $pushs=new Pushs();
        if(isset($_POST['sub'])){
            $res=$pushs->save(['amount'=>$_POST['amount']],['id'=>$_POST['id']]);
            if($res)
                $this->success('修改成功！','push/index');
            else
                $this->error('修改失败！','push/index');
        }
        $res=$pushs->AllData(['id'=>$_GET['id']]);
        return view('update',['res'=>$res]);
    }
    public function pushwater(){
        $push = new Pushs();
        $show = $push->pushwater();
        return view('pushwater',['show'=>$show]);
    }
}
